home *** CD-ROM | disk | FTP | other *** search
-
- #include <stdlib.h>
- #include <string.h>
- #include <stdio.h>
- #include <ctype.h>
-
- #include <exec/exec.h>
- #include <exec/memory.h>
- #include <exec/types.h>
-
- void __asm __saveds strNcpy(register __a0 UBYTE *dest,register __a1 UBYTE *source,register __d0 int chars)
- {
- int count=0;
-
- while ((dest[count]=source[count]) && count<chars-1) count++;
- dest[count+1]=0;
- }
-
- short __asm __saveds position(register __a0 char *substr,register __a1 char *str)
- {
- // returns an character offset of a substring in a string
- // this version is CASE SENSITIVE
- // returns -1 if substring not found in the string
-
- char *whstr;
- return((short)((whstr=strstr(str,substr)) ? (short)((LONG)whstr-(LONG)str) : -1));
- }
-
- void cleartags( char*filenames)
- {
- char filename[512];
- int where;
- while (filenames[0]) // any chars left ?
- {
- while ((filenames[0]==' ') && (filenames[0])) filenames++; //skip spaces..
-
- if (filenames[0])
- {
- if (where=position(" ",filenames))
- {
- strNcpy(filename,filenames,where);
- puts(filename);
- filenames+=where;
- }
- }
- }
-
- }
-
-
- void main(int argc,char *argv[])
- {
- cleartags(" banana banana2 ");
- }
-